package com.jevons.muffin.widget;

import android.widget.Toast;

import com.jevons.muffin.BaseApplication;


/**
 * 自定义Toast工具类
 * @author linaisheng
 * Create at 2019/3/20
 */
public class CustomToast {

    /**
     * shortShow
     *
     * @param resId 弹出信息的资源id
     */
    public static void shortShow(int resId) {
        shortShow(BaseApplication.getContext().getResources().getText(resId));
    }

    /**
     * shortShow
     *
     * @param toastMsg 信息字符
     */
    public static void shortShow(CharSequence toastMsg) {
        toastShow(toastMsg, Toast.LENGTH_SHORT);
    }

    /**
     * longShow
     *
     * @param resId 弹出信息的资源id
     */
    public static void longShow(int resId) {
        longShow(BaseApplication.getContext().getResources().getText(resId));
    }

    /**
     * longShow
     *
     * @param toastMsg 信息字符串
     */
    public static void longShow(CharSequence toastMsg) {
        toastShow(toastMsg, Toast.LENGTH_LONG);
    }

    /**
     * 弹出toast信息
     *
     * @param toastMsg 信息
     * @param duration 消失的时间
     */
    private static void toastShow(CharSequence toastMsg, int duration) {

        Toast.makeText(BaseApplication.getContext(), toastMsg, duration).show();
    }
}
